package com.matt.repository.impl;

import com.matt.domain.news.SystemNotificationMenu;
import com.matt.repository.base.BaseNativeSqlRepository;
import com.matt.repository.base.SystemNotificationMenuNativeRepository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * *******************************
 * Created by lch.
 * form com.matt
 * on $date$
 * *******************************
 */
@Service
public class SystemNotificationMenuNativeRepositoryImpl extends BaseNativeSqlRepository implements SystemNotificationMenuNativeRepository {


    @Override
    public List<SystemNotificationMenu> getNewsInfo() {
        String querySql = String.format("select sysm.id as id,sysm.menuId as menuId,sysm.menuName as menuName,sysm.systemNotificationId as systemNotificationId,sysm.content as content,sysm.isEdit as isEdit" +
                " FROM system_notification_menu as sysm where sysm.systemNotificationId =(select id from system_notification ns where ns.category=1 order by ns.createTime desc limit 0,1)");
        List<SystemNotificationMenu> list = sqlObjectList(querySql,SystemNotificationMenu.class);
        return list;
    }
}
